#include <iostream>
#include <fstream>
#include <vector>
#include <cassert>
using namespace std;

typedef int keytype;

void insert(vector<keytype> &keys)
{
  int i, j;

  for (i = 1; i < keys.size(); i++){
    int k = keys[i];
    j = i - 1;
    while (j >= 0 && keys[j] > k){
      keys[j+1] = keys[j];
      j--;
    }
    keys[j+1] = k;
  }
}

void print(vector<keytype> &keys)
{
  for (auto it = keys.begin(); it != keys.end(); it++)
    cout << *it << "\t";
  cout << endl;
}

int main()
{
  ifstream in("sort.txt");
  vector<keytype> keys;
  keytype k;

  assert(in);
  while (in >> k)
    keys.push_back(k);

  insert(keys);
  print(keys);
  in.close();

  return 0;
}
